﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Text;

namespace Akabana.Amf.Messaging.Messages
{
    public class RemotingMessage : AsyncMessage
    {
        public String source { get; set; }

        public String operation { get; set; }

        public override AcknowledgeMessage CreateAcknowledgeMessage(object body)
        {
            var result = base.CreateAcknowledgeMessage(body);

            var session = HttpContext.Current.Session;

            var remotingMessageClientId = session["remotingMessageClientId"];
            if (remotingMessageClientId == null)
            {
                remotingMessageClientId = Guid.NewGuid().ToString().ToUpper();
                session["remotingMessageClientId"] = remotingMessageClientId;
            }

            this.clientId = remotingMessageClientId.ToString();

            return result;
        }
    }
}
